#include"common.hpp"

int main()
{
    int shmid=GetShm();  //获取共享内存
    log(Debug,"create shm done");
    sleep(5);

    char *shmaddr=(char*)shmat(shmid,nullptr,0);  //关联共享内存
    log(Debug,"attach shm done,shmaddr: 0x%x",shmaddr);
    sleep(5);

    while(true)
    {
        cout<<"Please input@ ";
        fgets(shmaddr,4096,stdin);
    }

    shmdt(shmaddr);     //去关联
    log(Debug,"detach shm done,shmaddr: 0x%x",shmaddr);
    sleep(5);

    return 0;
}